<?php

use App\Models\AdminInfo;
use App\Models\User;
use Illuminate\Database\Seeder;

class UserTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $user = Sentinel::registerAndActivate([
                'username' => 'superadmin',
                'password' => 'superadmin',
                'is_admin' => 1,
            ]);
        $role = Sentinel::findRoleBySlug('superadmin');
        $role->users()->attach($user);
        AdminInfo::create([
            'user_id' => $user->id,
            'name' => 'superadmin',
            'phone' => 13912345678,
            ]);

        if(env('APP_ENV') == 'local'){
            $user = Sentinel::registerAndActivate([
                    'username' => 'simulate-user',
                    'password' => 'simulate-user',
                ]);
        }
        
    }
}
